package data

import (
	"errors"
	"github.com/obs-data-process/internal/data/obs"
	"github.com/obs-data-process/internal/pkg/config"
	"log"
)

func NewObsClient(obsConfig *config.ObsConfig) (*obs.ObsClient, func(), error) {
	log.Printf("obs config: %+v", obsConfig)
	if obsConfig == nil {
		return nil, nil, errors.New("obsConfig is nil")
	}
	client, err := obs.New(obsConfig.Ak, obsConfig.Sk, obsConfig.Endpoint)
	if err != nil {
		return nil, nil, err
	}
	return client, func() {
		//client.Close()
	}, nil
}
